
/**
 * Represents one spot (or tile?) inside the maze
 * 
 * @author Jofry HS
 * @version 16-07-2010
 */
public class Tile
{
    private boolean passable;   // A tile is passable if there's no obstacle sitting on it (non-passable ground)
    private boolean occupied;   // A tile is occupied if there's a robot sitting on it

    /**
     * Constructor for objects of class Tile
     */
    public Tile()
    {
        passable = true;
        occupied = false;
    }
    
    // Setters and getters
    public void setPassable(boolean b)
    {
        passable = b;
    }
    
    public void becomeOccupied()
    {
        occupied = true;
    }
    
    public boolean isPassable()
    {
        return passable;
    }
    
    public boolean isOccupied()
    {
        return occupied;
    }
    
    // A tile is free when both not occupied and passable
    public boolean isFree()
    {
        return (!(occupied) && passable);
    }   
    
    // Free a tile
    public void free()
    {
        passable = true;
        occupied = false;
    }
}
